<template>
  <div class="goods" @click="handleDetail">
    <img :src="gdata.img1" alt="" />
    <h3>{{ gdata.proname }}</h3>
    <p>{{ gdata.originprice }}</p>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from "vue-router";
import { IProType } from "../api/home";
interface IGoodsProps {
  gdata: IProType;
}
const props = defineProps<IGoodsProps>();
const router = useRouter();
const handleDetail = () => {
  // props.gdata.proId = props.gdata.objectId as string
  delete props.gdata.objectId;
  router.push({
    path: "/detail",
    query: {
      ...props.gdata,
    },
  });
};
</script>

<style lang="scss" scoped>
.goods {
  width: 33rem;
  /* background-color: orange; */
  margin-right: 3rem;
  margin-bottom: 3rem;
  &:nth-of-type(2n) {
    margin-right: 0;
  }
  img {
    width: 33rem;
  }
  h3 {
    font-size: 3rem;
  }
  p {
    font-size: 2.4rem;
  }
}
</style>
